*******************************************************************************************************************************
*******************************************************************************************************************************
* Documentation for Reproduction of
* Cottrell and Neuberg 2004 TESS Survey Experiment
* TESS Race Discrimination Meta-Analysis
* Stata version 15
* Data available here: http://www.tessexperiments.org/data/cottrell280.html
*******************************************************************************************************************************
*******************************************************************************************************************************

* use "tess18_cottrell_client_data.dta", clear
set more off

*******************************************************************************************************************************
*** Racial groups
*******************************************************************************************************************************

tab ppeth
gen whiteR = ppeth
gen blackR = ppeth
recode whiteR (2 3=0)
recode blackR (1 3=0) (2=1)
tab ppeth whiteR
tab ppeth blackR

*******************************************************************************************************************************
*** Treatments
*******************************************************************************************************************************

tab order
gen section1first = order
recode section1first (2=0)
tab order section1first

tab raceshow
gen whiteT = raceshow
gen blackT = raceshow
gen asianT = raceshow
recode whiteT (2 3=0)
recode blackT (1 3=0) (2=1)
recode asianT (1 2=0) (3=1)
tab raceshow whiteT
tab raceshow blackT
tab raceshow asianT

*******************************************************************************************************************************
*** Outcome variables
*******************************************************************************************************************************

tab1 s1_1- s2_8
recode s1_1- s2_8 (-1=.)
tab1 s1_1- s2_8

alpha s1_1 s1_7 s1_2 s1_3 s1_4 s1_5 s1_6 s2_1 s2_2 s2_3 s2_4 s2_6 s2_7 s2_8, item std min(7) gen(ALPHA)

sum ALPHA if whiteR==1
di r(sd)
gen ov_white_std = ALPHA/r(sd) if whiteR==1

sum ALPHA if blackR==1
di r(sd)
gen ov_black_std = ALPHA/r(sd) if blackR==1

*******************************************************************************************************************************
*** Racial manipulation check
*******************************************************************************************************************************

// No racial manipulation check

*******************************************************************************************************************************
*** Main regressions [Unweighted]
*******************************************************************************************************************************

reg ov_white_std whiteT section1first if asianT==0 & whiteR==1
reg ov_black_std whiteT section1first if asianT==0 & blackR==1
